﻿using Loxodon.Framework;
using Loxodon.Framework.XLua.Loaders;
using UnityGameFramework.Runtime;
using XLua;

namespace StarForce
{
    public class LuaComponent : GameFrameworkComponent
    {
        public void Init()
        {
            Log.Info("在这里自定义lua加载器！");
            LuaEnv luaEnv = LuaEnvironment.LuaEnv;
            
            luaEnv.AddLoader(new FileLoader("Assets/GameMain/Lua/",".lua"));
            luaEnv.AddLoader(new FileLoader("Assets/GameMain/Lua/",".lua.txt"));
            
            LuaEnvironment.LuaEnv.AddBuildin("rapidjson", XLua.LuaDLL.Lua.LoadRapidJson);
            LuaEnvironment.LuaEnv.AddBuildin("lpeg", XLua.LuaDLL.Lua.LoadLpeg);
            LuaEnvironment.LuaEnv.AddBuildin("pb", XLua.LuaDLL.Lua.LoadLuaProfobuf);
            LuaEnvironment.LuaEnv.AddBuildin("ffi", XLua.LuaDLL.Lua.LoadFFI);
        }
    }
}